﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

using WebApplication_01.class_helper;

namespace WebApplication_01.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class test001Controller : ControllerBase
    {
        // GET: api/test001
        //[HttpGet]
        //public dynamic Get()
        //{
        //    DapperHelper dh = new DapperHelper();

        //    //查询测试
        //    //List<object> list = dh.QuerySqlString<object>("select * from infotest_01 limit 10;");
        //    List<test001orm> list = dh.QuerySqlString<test001orm>("select * from infotest_01 limit 10;");
        //    return list;
        //}

        // GET: api/test001/5
        //[HttpGet("{id}", Name = "Get")]
        //public string Get(int id)
        //{
        //    return "value";
        //}

        public dynamic Get()
        {
            string rt = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            return rt;
            //DapperHelper dh = new DapperHelper();

            ////查询测试
            ////List<object> list = dh.QuerySqlString<object>("select * from infotest_01 limit 10;");
            //List<test001orm> list = dh.QuerySqlString<test001orm>("select * from infotest_01 limit 10;");
            //return list;
        }

        // POST: api/test001
        [HttpPost]
        public void Post([FromBody] string value)
        {
        }

        // PUT: api/test001/5
        [HttpPut("{id}")]
        public void Put(int id, [FromBody] string value)
        {
        }

        // DELETE: api/ApiWithActions/5
        [HttpDelete("{id}")]
        public void Delete(int id)
        {
        }
    }


    public class test001orm
    {
        public int ID { get; set; }
        public String name { get; set; }
        public String test { get; set; }
        public String creatdate { get; set; }
    }
}
